package utils;

import java.util.ArrayList;

import aw.Agent;
import aw.Static_Variables;


public class Room {
	
	private int _id;
	private int _firstPosX;
	private int _firstPosY;
	private int _lastPosX;
	private int _lastPosY;
	private ArrayList<Acessory> _acessories = new ArrayList<Acessory>();
	private ArrayList<Integer> _doors = new ArrayList<Integer>();
	private ArrayList<Agent> Agents = new ArrayList<Agent>();
	
	

	public Room(int id, int firstPosX, int firstPosY, int lastPosX, int lastPosY, ArrayList<Acessory> acessories, String doors){
		_id = id;
		_firstPosX = firstPosX;
		_firstPosY = firstPosY;
		_lastPosX = lastPosX;
		_lastPosY = lastPosY;
		_acessories = acessories;
		
		String[] doorsArray = doors.split("[*]");
		for (int i = 0; i<doorsArray.length;i++) {
			_doors.add(Integer.parseInt(doorsArray[i]));
		}
	}
	
	public int getId(){
		return _id;
	}
	
	public int getFirstPosX(){
		return _firstPosX;
	}
	
	public int getFirstPosY(){
		return _firstPosY;
	}
	
	public int getLastPosX(){
		return _lastPosX;
	}
	
	public int getLastPosY(){
		return _lastPosY;
	}
	
	public ArrayList<Acessory> getAcessories(){
		return _acessories;
	}
	public ArrayList<String> getAcessories_String(){
		ArrayList<String> resultado = new ArrayList<String>();
		for(int i=0; i<_acessories.size(); i++)
			resultado.add(_acessories.get(i).toString());
		
		return resultado;
	}
	
	public ArrayList<Door> getDoors(){
		ArrayList<Door> d = new ArrayList<Door>();
		for (Integer i : _doors) {
			d.add(Static_Variables.doorsTab.get(i));
		}
		return d;
	}
	
	public void removeAcessory(String id){
		
	}
	
	public ArrayList<Agent> getAgents() {
		return Agents;
	}

	public void setAgents(ArrayList<Agent> agents) {
		Agents = agents;
	}
}
